var h, halfh, halfw, margin, totalh, totalw, w;

h = 1300;

w = 400;

margin = {
  left: 60,
  top: 40,
  right: 40,
  bottom: 40,
  inner: 5
};

halfh = h + margin.top + margin.bottom;

totalh = halfh * 2;

halfw = w + margin.left + margin.right;

totalw = halfw * 2;

d3.json("/static/data.json", function(data) {
  var mychart;
  mychart = dotchart().xvar(0).yvar(1).ylim([500000,10000000])
	.xlab("X")
	.ylab("Y")
	.title("test")
	.height(h)
	.width(w)
	.margin(margin);

  d3.select("div#chart1").datum(data).call(mychart);
  return mychart.pointsSelect().on("mouseover", function(d) {
    return d3.select(this).attr("r", mychart.pointsize() * 3).on("click", function(d) {
      return d3.select(this).attr("fill", "Orchid").on("mouseout", function(d) {
        return d3.select(this).attr("fill", mychart.pointcolor()).attr("r", mychart.pointsize());
      });
    });
  }).on("mouseout", function(d) {
    return d3.select(this).attr("fill", mychart.pointcolor()).attr("r", mychart.pointsize());
  });
});

